<template>
  <div class="orderGoods">
    <div class="total">共{{ cartInfo.length }}件商品</div>
    <div class="goodWrapper">
      <div class="item acea-row row-between-wrapper" v-for="cart in cartInfo" :key="cart.id" @click="goproduct(cart)">
        <div class="pictrue">
          <img
            class="image"
            :src="(cart.productInfo.attrInfo && cart.productInfo.attrInfo.image) ? cart.productInfo.attrInfo.image : cart.productInfo.image"
          />
        </div>
        <div class="text">
          <div class="acea-row row-between-wrapper">
            <div class="name line1">{{ cart.productInfo.storeName }}</div>
            <div class="num">x {{ cart.cartNum }}</div>
          </div>
          <div
            class="attr line1"
            v-if="cart.productInfo.attrInfo"
          >{{ cart.productInfo.attrInfo.sku }}</div>
          <div class="money">
            <div class=" font-color-red" style="display: flex;">{{cart.payAmount==null?'':(cart.truePrice == cart.payAmount)?'':'￥'+cart.payAmount}}<span :class="cart.payAmount==null?'':(cart.truePrice == cart.payAmount)?'':'truePrice'">￥{{ cart.truePrice }}</span></div>
            <div style="display: flex;" v-if="!isMerchant">
				  <view class="discount-rate" v-if="cart.discountRate > 0 && cart.discountRate < 10">{{ cart.discountRate }}折</view>
              <view class='space'>
			  </view>
              <div
                class="pj"
                v-if="evaluate == 3 && cart.remarks == '5' && evaluateStatus != 1"
                @click.stop="$router.push({ path: '/pages/shop/GoodsEvaluate/main',query:{id:cart.unique} })"
              >评价</div>
              <div
                class="sqtk"
                v-if="(cart.remarks == '2' || cart.remarks == '4' || cart.remarks == '5' && cart.productInfo.isOffline != 1 ) && findshFlag && orderTypeName == '非砍价订单' && cart.productInfo.receiptType!=1"
                @click.stop="$router.push({ path: '/pages/order/GoodsReturn/main',query:{id:orderId,evaluate:evaluate,cartInfoId:cart.id,proname:cart.productInfo.storeName,pronum:cart.cartNum,promoney:cart.truePrice,proimg:cart.productInfo.image} })"
              >申请退款</div>
              <div v-if="cart.remarks == '3'" class="ordersta">未发货退款</div>
              <div v-else-if="cart.remarks == '6'" class="ordersta">已发货退款</div>
              <div v-else-if="cart.remarks == '7'" class="ordersta">等待买家发货</div>
              <div v-else-if="cart.remarks == '8'" class="ordersta">等待商家确认</div>
              <div v-else-if="cart.remarks == '9'" class="ordersta" @click.stop="$router.push({ path: '/pages/order/ReturnDetails/main',query:{id:cart.id} })">退款完成</div>
              <div v-else-if="cart.remarks == '10'" class="ordersta">交易完成</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "OrderGoods",
  props: {
    orderId:String,
    evaluate: Number,
    evaluateStatus: Number,
    cartInfo: {
      type: Array,
      default: () => []
    },
    findshFlag: {
      type: Boolean,
      default: () => true
    },
    isMerchant:{
      type: Boolean,
      default: () => false
    },
    orderTypeName: {
      type: String,
      default: '非砍价订单'
    },
  },
  data: function() {
    return {};
  },
  mounted: function() {

  },
  methods: {
    goproduct(cart){
      if(cart.productInfo.isOffline && cart.productInfo.isOffline == 1){
        this.$router.push({ path: '/pages/shop/GoodsCon/index',query:{id:cart.productInfo.id,offline:1}  })
      }else if(cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0){
        this.$router.push({ path: '/pages/shop/GoodsCon/index',query:{id:cart.productInfo.id}  })
      }else if(cart.combinationId > 0){
        this.$router.push({ path: '/pages/activity/GroupDetails/main',query:{id:cart.combinationId}})
      }else if(cart.bargainId > 0){
        this.$router.push({ path: '/pages/activity/DargainDetails/main',query:{id:cart.bargainId}})
      }else if(cart.seckillId > 0){
        this.$router.push({ path: '/pages/activity/SeckillDetails/main',query:{id:cart.seckillId}})
      }
    },
  }
};
</script>
<style>
.sqtk{
  width: 179rpx;
  height: 60rpx;
  text-align: center;
  line-height: 60rpx;
  border-radius: 50rpx;
  color: #999999;
  font-size: 28rpx;
  border: 1px #999999 solid;
  float: right
}
.pj{
  width: 179rpx;
  height: 60rpx;
  text-align: center;
  line-height: 60rpx;
  border-radius: 50rpx;
  color: #333333;
  font-size: 28rpx;
  border: 1px #333333 solid;
  float: right;
  margin-left: 18rpx;
}
.space{
width: 1rpx;
height: 100%;
float: left;
}
.ordersta{
  color: orange;
  font-size: 28rpx;
}
.truePrice{
  text-decoration: line-through;
  color: #999999;
  font-size: 28rpx;
  padding: 0 0 0 10rpx;
}
.discount-rate {
	color: #999999;
	font-weight: normal;
	font-size: 28rpx;
}
</style>
